<!--
 * @Author: wuchao66_Git 2803670835@qq.com
 * @Date: 2023-11-21 10:35:13
 * @LastEditors: wuchao66_Git 2803670835@qq.com
 * @LastEditTime: 2023-11-21 11:08:21
 * @FilePath: \t161xgvue\src\views\depart\depart.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div>
      部门页面
      <div id="main" style="width: 600px; height: 400px"></div>
    </div>
  </template>

<script>
import * as echarts from 'echarts';
import {findDeparts} from '../../api/department'
export default {
    data() {
    return {
      option1: {},
    };
  },
  created() {//有待考证
    this.getDepartMent1();
  },
  methods: {
    async getDepartMent1() {
      let res = await findDeparts();
      this.option1 = {//既然第一次接不上，那就一起异步
        title: {
          text: "用户管理系统图标161-162",
        },
        tooltip: {},
        xAxis: {
          data: res.data.names,
        },
        yAxis: {},
        series: [
          {
            name: "各部门人数",
            type: "pie",
            data: res.data.counts,
          },
        ],
      };
      var myChart = echarts.init(document.getElementById("main"));
      myChart.setOption(this.option1);
      //this.showPicture();//一切就位，再屌你，等于我第一次等于你的第二次
    }
  },

}
</script>

<style>

</style>